package server.db;

import java.sql.ResultSet;
import java.sql.SQLException;


/**
 * Very basic class for database objects
 */
public abstract class DBObject {
	private DataBase db;
	
	/**
	 * Initialize object
	 */
	public DBObject() {
		db = DataBase.getInstance();
	}
	
	/**
	 * Get DataBase object
	 * @return	DataBase object
	 */
	public DataBase getDB() { return db; }
	
	/**
	 * @see DataBase#doQuery(String)
	 * @param query		Query to execute
	 * @return			ResultSet from query
	 * @throws SQLException
	 */
	public ResultSet doQuery(String query) throws SQLException { return db.doQuery(query); }
	
	/**
	 * @see DataBase#doUpdate(String)
	 * @param query		Query to execute
	 * @return			ID if query was an INSERT
	 * @throws SQLException
	 */
	public int doUpdate(String query) throws SQLException { return db.doUpdate(query); }
}
